package com.qcrud.records;

import com.qcrud.JteTest;
import com.qcrud.annotation.Param;
import com.qcrud.annotation.Select;
import com.qcrud.core.paging.Paging;
import com.qcrud.mapper.QcrudMapper;

import java.util.List;
import java.util.Optional;

public interface PersonMapper extends QcrudMapper<Person, Integer> {

    @Select("""
        select name from person where id=${id}
        """)
    String selectNameById(@Param("id") int id);

    Optional<List<Person>> selectByEmailAndName(@Param("email") String email, @Param("name") String name);

    Paging<Person> pageByName(Paging<Person> page, @Param("name") String name);

    @Select("select * from person")
    List<Person> selectListAll();

    List<Person> selectByNameAndIds(@Param("tableName") String tableName,
                                    @Param("jt") JteTest jt,
                                    @Param("name") String name,
                                    @Param("ids") List<Integer> ids);

    // 无法执行方法
    Person cannotExecuteMethod();
}
